package cn.itcast.mapper;

import cn.itheima.goods.pojo.DishFlavor;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface DishFlavorMapper {

    /**
     * 批量删除
     *
     * @param flavors 批量删除子表
     */
    void insertBatch(List<DishFlavor> flavors);

    /**
     * 根据菜品id删除子表
     *
     * @param dishId 菜品id
     */
    @Delete("delete from dish_flavor where dish_id=#{dishId}")
    void deleteByDishId(Long dishId);

    /**
     * 根据菜品id获取口味
     *
     * @param dishId 根据菜品id获取口味
     * @return 口味列表
     */
    @Select("select * from dish_flavor where dish_id=#{dishId}")
    List<DishFlavor> getByDishId(Long dishId);

    /**
     * 根据菜品的ids删除口味
     *
     * @param dishIds 菜品ids
     */
    void deleteByDishIds(List<Long> dishIds);
}
